import service from '@/utils/request'

/**
 *  带分页的查询
 *  dictTypeId int
 *  PageOrderParam [ 分页参数：包括 order、asc ]
 */
export const getDataPage = (params) => {
    return service({
        url: '/api/sys/dict_data_page',
        method: 'get',
        params
    })
}

/**
 *  查询单条详情
 */
export const getDataOne = (id) => {
    return service({
        url: '/api/sys/dict_data',
        method: 'get',
        params: {id}
    })
}

/** 添加数据，参数如下：
 *  id         uint   
 *  dictTypeId int      字典类型ID
 *  dictLabel  string   字典标签
 *  dictValue  string   字典值
 *  labelClass string   标签样式
 *  sort       int32    排序
 *  Remark     string   备注
 */
export const addData = (data) => {
    return service({
        url: '/api/sys/dict_data',
        method: 'post',
        data
    })
}

export const updateData = (data) => {
    return service({
        url: '/api/sys/dict_data',
        method: 'put',
        data
    })
}

export const deleteData = (ids) => {
  return service({
    url: '/api/sys/dict_data',
    method: 'delete',
    data: {id_arr: ids}
  })
}
